<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>fasty</title>

    <script src="./fasty.js"></script>
    <script src="https://unpkg.com/art-template/lib/template-web.js"></script>

</head>

<body>
<script>

    // var testhtml = "a";
    // var testhtml = "{{~ for(item of array)}} xxx {{~end}}";
    // var testhtml = "{{~ for(item of array)}} xxx  {{~ for (newItem of item.xxx)}} xxxx  {{~end}} {{~end}}";
    // var testhtml = "{{~ for(item of array)}} xxx  {{~ for (newItem of item1.xxx)}} xxxx  {{~end}} {{~end}}";
    // var testhtml = "{{~ for(var x=0;x<100;i++)}}  xxx {{~end}}";
    // var testhtml = "{{~ for(var x=0,a=title;x<title.length;i++)}}  xxx{{a}} {{~end}}";
    // var testhtml = "{{~ var aaa = \"aaa\"}}";
    // var testhtml = "{{~ var aaa = \"aaa\"}}   {{~ for ( x of aaa)}}  {{aaa}}--{{x}}--{{end1}}--end {{~end}}";
    // var testhtml = "{{~ var aaa = \"aaa\"}}   {{~ for ( x of aaa)}}  {{aaa}}--{{x}}--{{end1}}--end {{~end}} {{x}} {{aaa}} {{bbb}}";
    // var testhtml = "{{~ var aaa = \"aaa\"}}   {{~ for ( x of aaa)}}  {{aaa}}--{{x}}--{{end1}}--end  {{~for (var i=0;i< x.length;i++)}}  {{x[i]}}  {{~end}} {{~end}} {{x}} {{aaa}} {{bbb}}";
    // var testhtml = "{{~ var aaa = \"aaa\"}}   {{~ for ( x of aaa)}}  {{aaa}}--{{x}}--{{end1}}--end  {{~for (var i=0;i< x.length;i++)}}  {{x[i]}} {{aaa}} {{bbb}} {{~end}} {{~end}} {{x}} {{aaa}} {{bbb}}";
    // var testhtml = "{{~if (a == b)}} xxx {{~end}}";
    // var testhtml = "{{~ var a = \"c\"}} {{~if (a == b)}} xxx {{~end}}";
    var testhtml = "{{~ var a = \"c\",b=\"c\"}} {{~if (a == b)}} xxx    {{~end}}{{title}}{{content}}";

    var data = {"title": "title test", "content": "content test..."};
    var fasty = new Fasty();

    let time1 = new Date().getTime();
    for (var i = 0; i < 10000; i++) {
        fasty.render(testhtml, data);
        // console.log(render)
    }
    console.log("time1 >>>> " + (new Date().getTime() - time1))
    time1 = new Date().getTime();

    for (var i = 0; i < 10000; i++) {
        var testhtml = "{{set a = \"c\"}} {{set b = \"c\"}} {{if a == b}} xxx    {{/if}}{{title}}{{content}}";
        template.render(testhtml, data);
    }
    console.log("time2 >>>> " + (new Date().getTime() - time1))
</script>

</body>

</html>
